home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 17886 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.7 KB

  1. Path: newsbf02.news.aol.com!not-for-mail
  2. From: dogmat@aol.com (Dogmat)
  3. Newsgroups: comp.lang.java,comp.lang.c++,comp.lang.smalltalk
  4. Subject: Re: Will Java kill C++?
  5. Date: 17 Apr 1996 20:03:49 -0400
  6. Organization: America Online, Inc. (1-800-827-6364)
  7. Sender: root@newsbf02.news.aol.com
  8. Message-ID: <4l40t5$j59@newsbf02.news.aol.com>
  9. References: <4l3qcr$8u3@cubenx.cube.de>
  10. Reply-To: dogmat@aol.com (Dogmat)
  11. NNTP-Posting-Host: newsbf02.mail.aol.com
  12.  
  13. >Forwarding is great and IMHO used way too little, maybe because many
  14. >people don't know something like it exists, or how easy, yet powerful
  15. >it is.
  16.  
  17. By forwarding, I assume you mean an object implements a message by sending
  18. the message along to another object. If so...
  19.  
  20. I fully agree with you its extremely powerful and useful, and I use it
  21. regularly. My big bitch about it in Smalltalk is the need to write the
  22. same message (message name at least) in more than one object. This makes
  23. it harder to maintain, because message modifications (I must be a bad
  24. programmer, I change method names a lot. I also add and remove them) must
  25. be performed in more than one location (bad OOP principle).
  26.  
  27. One option is to trap the #doesNotUnderstand: method and automate the
  28. propogation, but this is a poor solution, really.
  29.  
  30. Another option is to send messages in a generic message with an argument,
  31. e.g., propertyAt: or propertyAt:put:. I use this a great deal.
  32.  
  33. Another option is a pattern where you define a superclass with all the
  34. messages defined and implemented as passing the message along. Subclasses
  35. then override this message and handle it explicitly. This is powerful, but
  36. makes things too "global". In the ridiculous limit, all methods ever
  37. written are also located in the Object class.
  38.  
  39. None of these solutions is optimal. Still looking...
  40.